/**
 * Created by huangjian on 2016/7/18.
 */

import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;

/**
 * <PRE>
 * 解析xml文件，并存入数据库
 * </PRE>
 * <B>项    目：</B>J2EE开发平台
 * <B>技术支持：</B>三盟科技 (c) 2016
 *
 * @author 黄坚：huangjian@sunmnet.com
 * @version 1.0 2016/7/18
 * @since jdk版本：jdk1.7
 */
public class XmlToDb {


	static String filePath = "";
	static String ip = "";
	static String port = "";
	static String username = "";
	static String pwd = "";
	static String dbName = "";
	static int insertNum = 100 * 10000;

	/**
	 * 方法入口
	 *
	 * xml解析
	 * 获取数据库连接
	 * 数据处理
	 * 数据库入口
	 *
	 * @param args
	 */
	public static void main(String[] args) throws SQLException {

		List list = getXMLDatas(filePath);

		insertDbFun(list);



	}

	public static void insertDbFun(List list) throws SQLException {
		Connection conn = null;

		try {
			conn = getConn(ip, username, pwd, dbName, port);
			for (Object obj : list) {

//				Object newObj = dealObj(obj);

				insertDb(conn, obj);

			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			if (conn != null) {
				conn.close();;
			}
		}



	}

	public static void insertDb(Connection conn, Object newObj) {


	}

	public static Object dealObj(Object obj) {
		return null;
	}

	public static List getXMLDatas(String filePath) {

//		dealObj(obj)
		return null;
	}

	public static Connection getConn(String ip, String username, String pwd, String dbName, String port) {
		return null;
	}


}
